/**
 * place页面传值
 */
var setPLaceData = function (){
    var placeId =  $('#placeId', parent.document).val();
    $("#id").val(placeId);

    var placePid =  $('#placePid', parent.document).val();
    $("#pid").val(placePid);

    var placeText =  $('#placeText', parent.document).val();
    $("#text").val(placeText);

    var placeName =  $('#placeName', parent.document).val();
    $("#place").val(placeName);

    var placeLongitude =  $('#placeLongitude', parent.document).val();
    $("#longitude").val(placeLongitude);

    var placeDimension =  $('#placeDimension', parent.document).val();
    $("#dimension").val(placeDimension);

    var placeType =  $('#placeType', parent.document).val();
    $("#type").val(placeType);
}

var placeDataAddOrEdit = function (){
    var placeId = $("#id").val();
    var placePid = $("#pid").val();
    var placeText = $("#text").val();
    var placeName = $("#place").val();
    var placeLongitude = $("#longitude").val();
    var placeDimension = $("#dimension").val();
    var type = $("#type").val();
    if (placePid == '') {
        layer.msg('父级id为空');
    } else if (placeText == '') {
        layer.msg('地点名字为空');
    } else if (placeName == ''){
        layer.msg('地点全称为空');
    } else if (placeLongitude == ''){
        layer.msg('经度为空');
    } else if (placeDimension == ''){
        layer.msg('维度为空');
    }else {
        $.ajax({
            url: "/place/placeData/addOrEdit",
            data: {
                "placeId" : placeId,
                "placePid": placePid,
                "placeText": placeText,
                "placeName": placeName,
                "placeLongitude": placeLongitude,
                "placeDimension": placeDimension,
                "type": type
            },
            type: "post",
            success: function (res){
                if (res.state == false){
                    layer.msg(res.msg);
                }else{
                    layer.msg("添加成功");
                }
            }
        })
    }
}
